/**
 * <copyright>
 *
 * Copyright (c) 2011 Zeligsoft (2009) Limited
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors: 
 *   Zeligsoft (2009) Limited - Initial API and implementation
 *
 * </copyright>
 *
 */
package org.omg.deployment.components;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.eef.runtime.api.parts.IPropertiesEditionPart;
import org.eclipse.emf.eef.runtime.context.PropertiesEditingContext;
import org.eclipse.emf.eef.runtime.impl.components.ComposedPropertiesEditionComponent;
import org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider;
import org.omg.deployment.ArtifactDeploymentDescription;
import org.omg.deployment.parts.ArtifactDeploymentDescriptionPropertiesEditionPart;
import org.omg.deployment.parts.DeploymentViewsRepository;
import org.omg.deployment.parts.XMIPropertiesEditionPart;


/**
 * @author Toby McClean; Zeligsoft (2009) Limited
 * @generated
 */
public class ArtifactDeploymentDescriptionPropertiesEditionComponent extends ComposedPropertiesEditionComponent {

	/**
	 * The Base part
	 * @generated
	 */
	private ArtifactDeploymentDescriptionPropertiesEditionPart basePart;

	/**
	 * The ArtifactDeploymentDescriptionBasePropertiesEditionComponent sub component
	 * @generated
	 */
	protected ArtifactDeploymentDescriptionBasePropertiesEditionComponent artifactDeploymentDescriptionBasePropertiesEditionComponent;

	/**
	 * The XMI part
	 * @generated
	 */
	private XMIPropertiesEditionPart xMIPart;

	/**
	 * The ArtifactDeploymentDescriptionXMIPropertiesEditionComponent sub component
	 * @generated
	 */
	protected ArtifactDeploymentDescriptionXMIPropertiesEditionComponent artifactDeploymentDescriptionXMIPropertiesEditionComponent;
	/**
	 * Parameterized constructor
	 * 
	 * @param artifactDeploymentDescription the EObject to edit
	 * @generated
	 */
	public ArtifactDeploymentDescriptionPropertiesEditionComponent(PropertiesEditingContext editingContext, EObject artifactDeploymentDescription, String editing_mode) {
    super(editingContext, editing_mode);
    if (artifactDeploymentDescription instanceof ArtifactDeploymentDescription) {
      PropertiesEditingProvider provider = null;
      provider = (PropertiesEditingProvider)editingContext.getAdapterFactory().adapt(artifactDeploymentDescription, PropertiesEditingProvider.class);
      artifactDeploymentDescriptionBasePropertiesEditionComponent = (ArtifactDeploymentDescriptionBasePropertiesEditionComponent)provider.getPropertiesEditingComponent(editingContext, editing_mode, ArtifactDeploymentDescriptionBasePropertiesEditionComponent.BASE_PART, ArtifactDeploymentDescriptionBasePropertiesEditionComponent.class);
      addSubComponent(artifactDeploymentDescriptionBasePropertiesEditionComponent);
      provider = (PropertiesEditingProvider)editingContext.getAdapterFactory().adapt(artifactDeploymentDescription, PropertiesEditingProvider.class);
      artifactDeploymentDescriptionXMIPropertiesEditionComponent = (ArtifactDeploymentDescriptionXMIPropertiesEditionComponent)provider.getPropertiesEditingComponent(editingContext, editing_mode, ArtifactDeploymentDescriptionXMIPropertiesEditionComponent.XMI_PART, ArtifactDeploymentDescriptionXMIPropertiesEditionComponent.class);
      addSubComponent(artifactDeploymentDescriptionXMIPropertiesEditionComponent);
    }
  }

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.eclipse.emf.eef.runtime.impl.components.ComposedPropertiesEditionComponent#
	 *      getPropertiesEditionPart(int, java.lang.String)
	 * @generated
	 */
	public IPropertiesEditionPart getPropertiesEditionPart(int kind, String key) {
    if (ArtifactDeploymentDescriptionBasePropertiesEditionComponent.BASE_PART.equals(key)) {
      basePart = (ArtifactDeploymentDescriptionPropertiesEditionPart)artifactDeploymentDescriptionBasePropertiesEditionComponent.getPropertiesEditionPart(kind, key);
      return (IPropertiesEditionPart)basePart;
    }
    if (ArtifactDeploymentDescriptionXMIPropertiesEditionComponent.XMI_PART.equals(key)) {
      xMIPart = (XMIPropertiesEditionPart)artifactDeploymentDescriptionXMIPropertiesEditionComponent.getPropertiesEditionPart(kind, key);
      return (IPropertiesEditionPart)xMIPart;
    }
    return super.getPropertiesEditionPart(kind, key);
  }

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.eclipse.emf.eef.runtime.impl.components.ComposedPropertiesEditionComponent#
	 *      setPropertiesEditionPart(java.lang.Object, int,
	 *      org.eclipse.emf.eef.runtime.api.parts.IPropertiesEditionPart)
	 * @generated
	 */
	public void setPropertiesEditionPart(java.lang.Object key, int kind, IPropertiesEditionPart propertiesEditionPart) {
    if (DeploymentViewsRepository.ArtifactDeploymentDescription.class == key) {
      super.setPropertiesEditionPart(key, kind, propertiesEditionPart);
      basePart = (ArtifactDeploymentDescriptionPropertiesEditionPart)propertiesEditionPart;
    }
    if (DeploymentViewsRepository.XMI.class == key) {
      super.setPropertiesEditionPart(key, kind, propertiesEditionPart);
      xMIPart = (XMIPropertiesEditionPart)propertiesEditionPart;
    }
  }

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.eclipse.emf.eef.runtime.impl.components.ComposedPropertiesEditionComponent#
	 *      initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject,
	 *      org.eclipse.emf.ecore.resource.ResourceSet)
	 * @generated
	 */
	public void initPart(java.lang.Object key, int kind, EObject element, ResourceSet allResource) {
    if (key == DeploymentViewsRepository.ArtifactDeploymentDescription.class) {
      super.initPart(key, kind, element, allResource);
    }
    if (key == DeploymentViewsRepository.XMI.class) {
      super.initPart(key, kind, element, allResource);
    }
  }
}
